﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Global.Master" AutoEventWireup="true" CodeBehind="ObrasShowTable.aspx.cs" Inherits="WebAsbesto.Obras.ObrasShowTable" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="auto-style2" align="center">
        <tr>
            <td colspan="2">
                <asp:Label ID="lbl_Titulo" runat="server" Text="Obras" Style="text-align: center" Font-Size="25" ForeColor="Green"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lbl_Razon_Social" runat="server" Text="Cliente: "></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddl_Clientes" runat="server" DataSourceID="Clientes" DataTextField="Razon_Social" DataValueField="Id_Cliente">
                </asp:DropDownList>
                <asp:SqlDataSource ID="Clientes" runat="server" ConnectionString="<%$ ConnectionStrings:AsbestoConnectionString %>" SelectCommand="Clientes_Obras_L" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Button ID="btn_Buscar" runat="server" Text="Buscar" OnClick="btn_Buscar_Click" />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="btn_Ingresar_Nueva_Obra" runat="server" Text="Nueva" OnClick="btn_Ingresar_Nueva_Obra_Click" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;</td>
        </tr>
    </table>

    <asp:GridView ID="Grd_Datos_Obra" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Horizontal" AllowSorting="True" DataKeyNames="Id_Obra">
        <Columns>
            <asp:BoundField DataField="Id_Obra" HeaderText="Id_Obra" InsertVisible="False" ReadOnly="True" SortExpression="Id_Obra" Visible="False" />
            <asp:BoundField DataField="Nombre" HeaderText="Nombre" SortExpression="Nombre" />
            <asp:BoundField DataField="Razon_Social" HeaderText="Razon_Social" SortExpression="Razon_Social" ReadOnly="True" />
            <asp:BoundField DataField="Fecha_Inicio" HeaderText="Fecha_Inicio" SortExpression="Fecha_Inicio" />
            <asp:BoundField DataField="Fecha_Fin" HeaderText="Fecha_Fin" SortExpression="Fecha_Fin" />
            <asp:BoundField DataField="Direccion_Obra" HeaderText="Direccion_Obra" SortExpression="Direccion_Obra" />
            <asp:BoundField DataField="Contacto" HeaderText="Contacto" SortExpression="Contacto" />
            <asp:BoundField DataField="Trabajo_A_Realizar" HeaderText="Trabajo_A_Realizar" SortExpression="Trabajo_A_Realizar" />
            <asp:BoundField DataField="Nota" HeaderText="Nota" SortExpression="Nota" />
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ButtonType="Image" CancelImageUrl="~/Images/cancelar.png" DeleteImageUrl="~/Images/Eliminar.gif" EditImageUrl="~/Images/editar.png" UpdateImageUrl="~/Images/Aceptar.png" />
        </Columns>
        <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
        <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F7F7F7" />
        <SortedAscendingHeaderStyle BackColor="#4B4B4B" />
        <SortedDescendingCellStyle BackColor="#E5E5E5" />
        <SortedDescendingHeaderStyle BackColor="#242121" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AsbestoConnectionString %>" DeleteCommand="Obras_B" DeleteCommandType="StoredProcedure" InsertCommand="Obras_A" InsertCommandType="StoredProcedure" SelectCommand="Obras_L" SelectCommandType="StoredProcedure" UpdateCommand="Obras_M" UpdateCommandType="StoredProcedure">
        <DeleteParameters>
            <asp:Parameter Name="Id_Obra" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Id_Cliente" Type="Int32" />
            <asp:Parameter Name="Nombre" Type="String" />
            <asp:Parameter Name="Fecha_Inicio" Type="DateTime" />
            <asp:Parameter Name="Fecha_Fin" Type="DateTime" />
            <asp:Parameter Name="Direccion_Obra" Type="String" />
            <asp:Parameter Name="Contacto" Type="String" />
            <asp:Parameter Name="Trabajo_A_Realizar" Type="String" />
            <asp:Parameter Name="Nota" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="ddl_Clientes" Name="Id_Cliente" PropertyName="SelectedValue" Type="Int32" DefaultValue="-1" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Id_Obra" Type="Int32" />
            <asp:Parameter Name="Nombre" Type="String" />
            <asp:Parameter Name="Fecha_Inicio" Type="DateTime" />
            <asp:Parameter Name="Fecha_Fin" Type="DateTime" />
            <asp:Parameter Name="Direccion_Obra" Type="String" />
            <asp:Parameter Name="Contacto" Type="String" />
            <asp:Parameter Name="Trabajo_A_Realizar" Type="String" />
            <asp:Parameter Name="Nota" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>

    <br />

</asp:Content>
